import SwiftUI
import SPGlassKit

public struct GlassFloatingButtonExample: GlassExample {
    public static let componentID = "glass-floating-button"
    @State private var notes = ["Groceries", "Reading list", "Trip ideas"]
    @State private var isExtended = true

    public init() {}

    public var body: some View {
        List {
            Toggle("Show title", isOn: $isExtended)
            ForEach(notes, id: \.self) { Text($0) }
        }
        .frame(minHeight: 280)
        .glassFloatingButton("New note", systemImage: "plus", position: .bottomTrailing, isExtended: isExtended) {
            notes.append("Note \(notes.count + 1)")
        }
    }
}

#Preview("GlassFloatingButton") { GlassFloatingButtonExample() }
